package com.wyl.clinic.enums;

import java.util.Arrays;
import java.util.Objects;

public enum RoleEnum {

    //全局角色
    SUPERADMIN(0,"超级管理员"),
    CLINICADMIN(1,"诊所管理员"),
    DOCTOR(2,"医生"),
    PATIENT(3,"患者");


    private Integer code;

    private String desc;

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    RoleEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static RoleEnum findByCode(Integer code){
        return Arrays.stream(RoleEnum.values()).filter(item -> Objects.equals(item.getCode(),code)).findFirst().orElse(null);
    }
}
